package net.htjs.juc.biased;

import lombok.extern.slf4j.Slf4j;
import org.openjdk.jol.info.ClassLayout;

/**
 * 测试偏向锁
 * 查看对象头
 * <!-- https://mvnrepository.com/artifact/org.openjdk.jol/jol-core -->
 * <dependency>
 *     <groupId>org.openjdk.jol</groupId>
 *     <artifactId>jol-core</artifactId>
 *     <version>0.10</version>
 * </dependency>
 */
@Slf4j
public class TestBiasedLock {

    static Object object = new Object();

    public static void main(String[] args) throws InterruptedException {
        log.info(ClassLayout.parseInstance(object).toPrintable(object));
        Thread.sleep(4000);
        log.info(ClassLayout.parseInstance(new Object()).toPrintable());
    }
}
